	package snake.game;								//Right!

import java.awt.BorderLayout;

import javax.swing.JFrame;

import snake.controller.Controller;
import snake.entities.Food;
import snake.entities.Ground;
import snake.entities.Snake;
import snake.util.Global;
import snake.view.GamePanel;

public class Game {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Snake snake = new Snake();
		Food food = new Food();
		Ground ground = new Ground();
		GamePanel gamePanel= new GamePanel();
		Controller controller = new Controller(snake,food,ground,gamePanel);
		
		JFrame jf = new JFrame();
		jf.setTitle("Snake");
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jf.add(gamePanel,BorderLayout.CENTER);
		gamePanel.setSize(Global.CELL_SIZE * Global.LENGTH, Global.CELL_SIZE * Global.HEIGHT);
		jf.setSize(Global.CELL_SIZE * Global.LENGTH + 15,Global.CELL_SIZE * Global.HEIGHT + 38);
		jf.setVisible(true);
		
		gamePanel.addKeyListener(controller);
		jf.addKeyListener(controller);
		snake.addSnakeListener(controller);
		
		controller.newGame();
	}
	
	

}
